﻿Public Class frmCategoryeditor

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Cmd.Parameters("@name") = Me.txtname.Text
        Cmd.Parameters("@type") = Me.txttype.Text
        If Me.txtid.Text = "" Then
            Cmd.ExecuteNonQuery("INSERT INTO Category VALUES(@name,@type,1);")
        Else
            Cmd.Parameters("@Id") = txtid.Text
            Cmd.ExecuteNonQuery("UPDATE Category SET CategoryName=@name,TypeId=@type WHERE CategoryId=@Id")
        End If

        Me.DialogResult = Windows.Forms.DialogResult.OK
        product.loaddata()
        Me.Close()
    End Sub
End Class